#!/usr/bin/env python
# -*- coding: utf-8 -*-#

#-------------------------------------------------------------------------------
# Name:         find_path
# Description:  
# Author:       handa
# Date:         2022/5/20
#-------------------------------------------------------------------------------

def find_path(t, x):
    """
    >>> t = Tree(2, [Tree(7, [Tree(3), Tree(6, [Tree(5), Tree(11)])]), Tree(15)])
    >>> find_path(t, 5)
    [2, 7, 6, 5]
    >>> find_path(t, 10)  # returns None
    """
    if t.label == x:
        return [ t.label ]
    for b in t.branches:
        path = find_path(b,x)
        if path:
            return [ t.label ] + path